#include "MCConstraintsManager.h"
#include <MCUtils.h>
#include <MCConstraint.h>

MCConstraintsManager::MCConstraintsManager()
{
}

void MCConstraintsManager::addConstraint(MCConstraint *constraint)
{
    _constraints.push_back(constraint);
    constraint->resolve();
}

void MCConstraintsManager::removeConstraint(MCConstraint *constraint)
{
    _constraints.erase(std::remove(_constraints.begin(), _constraints.end(), constraint), _constraints.end());
}

void MCConstraintsManager::resolve()
{
    for (size_t i = 0; i < _constraints.size(); i++)
    {
        _constraints[i]->resolve();
    }
}
